import Vue from "vue";

import App from "./App.vue";

import Home from "./Home.vue";
import Shop from "./Shop.vue";
import User from "./User.vue";
import NotFound from "./NotFound.vue";

import VueRouter from "vue-router";

Vue.use(VueRouter); //插件

const router = new VueRouter({
  routes: [
    {
      path: "/home/list",
      component: Home,
    },
    {
      // #/shop/100/row/200?age=20&name=jack#hello
      // {id:100,rid:200}

      path: "/shop/:id/row/:rid",
      component: Shop,
    },
    {
      path: "/user/id/1",
      component: User,
    },
    {
      // /cart
      path: "*", //匹配一切
      component: NotFound,
    },
  ],
});

new Vue({
  render: (h) => h(App),
  router, //路由注入
}).$mount("#app");
